$(function(){
	$("#submit").click(function(){
		submit()
	})
	function submit(){
		$.ajax({
			type: "post",
			url: "/loginpwd",
			headers: {
				"Content-Type": "application/json",
			},
			data: {
				"loginuser":$("#loginuser").val(),
				"loginpwd" : $("#loginpwd").val()
			},
			dataType: "json",
			success: function(b) {
				if (b.state == 0) {
					window.location = "/index.html";
					sessionStorage.setItem('login_user', $("#loginuser").val())
				} else {
					sessionStorage.clear()
					alert('登录失败')
				}
			},
			error: function(b) {
				sessionStorage.clear()
				alert('登录失败')
			}
		})
	}
})